using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using CodePlex.Resourceful.Amazon.S3;
using System.Diagnostics;

namespace CodePlex.Resourceful.Test
{
    [TestClass]
    public class BalticTests
    {
        [TestMethod]
        public void Baltic_Tests()
        {

            string aws = Environment.GetEnvironmentVariable("AWS");

            string accessKeyID = aws.Split(':')[0];
            string secretAccessKey = aws.Split(':')[1];


            S3Connection s3 = new S3Connection(accessKeyID, secretAccessKey, false);

            s3.Tracer.AddListener(TraceTextWriter.Instance);


           // ListBucketsResult rt = s3.ListBuckets();

            Assert.AreEqual(accessKeyID, s3.AccessKeyID);



            string balticKey = "baltic";
            string balticPassword = "password";

            S3Client balticClient = new S3Client(balticKey, balticPassword, new Uri("http://192.168.10.5:8080"));

            S3Connection baltic = new S3Connection(balticClient,RequestStyle.Path);

            baltic.Tracer.AddListener(TraceTextWriter.Instance);

            Assert.AreEqual(balticKey, baltic.AccessKeyID);




            baltic.DeleteBucket("asdf");

            Assert.IsFalse(baltic.ListBuckets().Buckets.Exists("asdf"));

            baltic.CreateBucket("asdf");

            Assert.IsTrue(baltic.ListBuckets().Buckets.Exists("asdf"));

            baltic.DeleteBucket("asdf");

            Assert.IsFalse(baltic.ListBuckets().Buckets.Exists("asdf"));


        }


    }
}
